<template>
    <el-tooltip class="item" effect="dark" content="双击可复制" placement="top-start">
        <span :data-clipboard-text="text" class="btnCopy" @dblclick="copySku()">{{
            text }}<i class="el-icon-info"></i>
        </span>
    </el-tooltip>
</template>
<script>
import Clipboard from 'clipboard'
export default {
    name: 'CErpImage',
    data() {
        return {}
    },
    props: {
        text: {
            type: String,
            default: ""

        }
    },
    methods: {
        copySku: function() {
            var me = this;
            var clipboard = new Clipboard(".btnCopy");
            clipboard.on('success', () => {

                clipboard.destroy();
                me.successMessage('复制成功');


            })
            clipboard.on('error', e => {

                me.errorMessage('该浏览器不支持自动复制' + e)

                clipboard.destroy()
            })
        }

    }
}
</script>
<style scoped>
</style>